<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const obj = {
        name:'kobe',
        age:18,
        play(){
            console.log('I like play basketball')
        }
    }

    const o1 = Object.create(obj)
    console.log(o1)
    // console.log(o1.__proto__===obj)

    //实现Object.create()方法
    function MyCreate(obj){
        function F(){}
        F.prototype = obj
        return new F()
    }
    const o2 = MyCreate(obj)
    console.log(o2)
    // 在阅读vue等框架源码时会看到作者在创建一个空对象时，常常使用Object.create(null)，这样做的目的是防止Object构造函数的原型被修改时对新建的对象产生影响
</script>
</body>
</html>